//
//  ByCoreToolAlert.h
//  beibei_ios
//
//  Created by hebidu on 16/4/16.
//  Copyright © 2016年 hebidu. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum : NSUInteger {
    ByAlertPositionModeTop,
    ByAlertPositionModeCenter,
    ByAlertPositionModeBottom,
} ByAlertPositionMode;

typedef enum : NSUInteger {
    ByAlertStateModeSuccess,
    ByAlertStateModeFailure,
} ByAlertStateMode;
/** 自定义提醒弹框 */

@interface ByCoreToolAlert : NSObject

#pragma mark - ********************* 新版的提示框 *********************
/*
 tips:
 1.默认显示时长为2秒
 */

// 仅显示文字
+ (void)showOnlyText:(NSString *)text;
+ (void)showOnlyText:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showOnlyText:(NSString *)text position:(ByAlertPositionMode)position;
+ (void)showOnlyText:(NSString *)text position:(ByAlertPositionMode)position duration:(CGFloat)duration;

// 加载中
+ (void)showLoadind:(NSString *)text;
+ (void)showLoadind:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showLoadind:(NSString *)text duration:(CGFloat)duration;


// 成功/失败
+ (void)showText:(NSString *)text state:(ByAlertStateMode)state;
+ (void)showText:(NSString *)text state:(ByAlertStateMode)state duration:(CGFloat)duration;
+ (void)showFailureWithText:(NSString *)text;   // 对上面显示状态的封装
+ (void)showFailureWithText:(NSString *)text hasMasker:(BOOL)hasMasker;
+ (void)showSuccessWithText:(NSString *)text;   // 对上面显示状态的封装
+ (void)showSuccessWithText:(NSString *)text hasMasker:(BOOL)hasMasker;

// 加载进度
typedef void(^ByProgressUpload)(CGFloat progress, BOOL competion);
+ (MBProgressHUD *)showProgress:(NSString *)text action:(void(^)(ByProgressUpload progress))actionBlock;
+ (MBProgressHUD *)showProgress:(NSString *)text action:(void(^)(ByProgressUpload progress))actionBlock hasMasker:(BOOL)hasMasker;

/*
 使用举例
 __block CGFloat p = 0;
 [ByCoreToolAlert showProgress:nil action:^(ByProgressUpload progress) {
 
    // 模拟请求
    dispatch_async(dispatch_get_global_queue(0, 0), ^{
 
        while (p < 1) {
            p += 0.01;
            progress(p, false);
            usleep(50000);
        }
 
        progress(p, true);
    });
 
 }];
 */

// 隐藏hud
+ (void)hideHud;






@end
